package bookmanagement.user;

import bookmanagement.operation.IOperation;
import bookmanagement.operation.impl.*;

import java.util.Scanner;

public class AdminUser extends User{
    private Scanner scanner = new Scanner(System.in);
    public AdminUser(String name) {
        this.name = name;
        operations = new IOperation[] {
                new AddOperation(),
                new DelOperation(),
                new UpdateOperation(),
                new FindOperation(),
                new DisplayOperation(),
        };
    }
    @Override
    public int menu() {
        System.out.println("====================================");
        System.out.println("欢迎"+this.name+"登录图书管理系统");
        System.out.println("1.添加书籍");
        System.out.println("2.删除书籍");
        System.out.println("3.更新书籍");
        System.out.println("4.查找书籍");
        System.out.println("5.显示当前书籍列表");
        System.out.println("-1.退出");
        System.out.println("请输入您的选择");
        int choice = scanner.nextInt();
        System.out.println("====================================");
        if (choice == -1) {
            close();
        }
        return choice;
    }

    public void close() {
        scanner.close();
    }
}
